package com.Register.controller.user;

import com.Register.dto.CarouselDTO;
import com.Register.result.Result;
import com.Register.service.CarouselService;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("appletCarouselController")
@RequestMapping("/applet/user/carousel")
@Tag(name = "小程序端-轮播图接口")
@Slf4j
public class CarouselController {
    @Resource
    private CarouselService carouselService;

    /*
    用户端展示轮播图
     */
    @GetMapping("/active")
    @Operation(summary = "用户端展示轮播图")
    public Result<List<CarouselDTO>> getActiveCarousels() throws JsonProcessingException{
        return Result.success(carouselService.getActiveCarousels());
    }
}
